<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="renderer" content="webkit">
	<title>祥利百悦</title>
	<link rel="stylesheet" href="../../css/bootstrap.min.css" />
	<link rel="stylesheet" href="../../css/common.css" />
	<link rel="stylesheet" href="../../css/welcome.css" />
	<link rel="stylesheet" href="../../css/validationEngine.jquery.css" /><!--表单验证css-->
	<script type="text/javascript" src="../../js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.validationEngine-zh_CN.js" ></script>
	<script type="text/javascript" src="../../js/jquery.validationEngine.js" ></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript" src="../../js/jquery.ptTimeSelect.js" ></script><!--日历插件-->
</head>

<body>
<div class="main_content create_site">
	<div class="col-xs-12 col-sm-12 div_bordered">
		<div class="panel panel-default choose_block">
			<div class="fixed_top panel panel-default choose_block">
				<div class="panel-heading color333 ">长者信息
					<a class="btn btn_blueg2 pull-right" href="${ctx }/member/get_member_list?station=${member.serverStationCode}" style="margin-right: 10px;">&lt;返回列表</a>
				</div>
			</div>
			<div class="panel-heading color333">长者信息
				<a href="member_list.html" class="colorbg font14 pull-right mr15">&lt;&lt;返回列表</a>
			</div>
			<div class="divider">
				<input type="hidden" id="member_id" value="${memberBase.memberId}">
				<input type="hidden" id=server_station_code value="${memberBase.serverStationCode}">
				<c:set var="member_page_flag" scope="session" value="1"></c:set>
			</div>
			<div class="site_block member_block">
				<div class="well_head">
					<div class="line"></div>
					<span class="pull-left">基础信息</span>
					<button type="button" class="btn btn-save btn-sm pull-right" id="member_base">保存</button>
				</div>
				<div id="member_base_jsp">
					<div class="panel-body relative">
						<form class="form-horizontal" style="position: absolute;top: 15px;left: 650px;width:200px;">
							<div class="form-group tx-block">
								<div class="upload_img" style="width:auto">
									<input type="hidden" id="avatar_url1" value=""/>
									<div id="wait_loading">
										<img src="img/touxiang.jpg" width="200px" height="254px" id="avatar_url"/>
									</div>
									<a href="javascript:;" class="ofile" style="color: #26a2f1;">上传头像
										<input type="file" id="myFile" name="myFile"/>
									</a>
								</div>
							</div>
						</form>
						<form class="form-horizontal" role="form" id="member_base_from">
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label" >姓名：</label>
								<div class="col-sm-10">
									<p id="name1">${memberBase.name}</p>
								</div>
							</div>
							<div class="form-group">
								<label for="lastname" class="col-sm-2 control-label">性别：</label>
								<div class="col-sm-10" id="sex1_3">
									<label class="label_radio">
										<input id="man" name="sex" type="radio" onclick="setupLabel()" value="1" ${ memberBase.sex eq 1 ? 'checked': ''}> 男
									</label>
									<label class="label_radio">
										<input id="woman" name="sex" type="radio" onclick="setupLabel()" value="0" ${memberBase.sex eq 0 ? 'checked': ''}> 女
									</label>
								</div>
							</div>
							<div class="form-group" >
								<label for="" class="col-sm-2 control-label">证件类型：</label>
								<div class="col-sm-10">
									<div class="btn-group inline ml150" id="idType">
										<button type="button" class="btn btn-default dropdown-text" value="${empty memberBase || empty memberBase.IDType ? 0 : memberBase.IDType}" style="width: 126px;">
											身份证
										</button>
										<button type="button" class="btn btn-default dropdown-toggle">
											<span class="caret"></span>
											<span class="sr-only">切换下拉菜单</span>
										</button>
										<ul class="dropdown-menu">
											<li><a value="0" href="javascript:void(0);">身份证</a></li>
											<li><a value="1" href="javascript:void(0);">港澳通行证</a></li>
											<li><a value="2" href="javascript:void(0);">台湾通行证</a></li>
											<li><a value="3" href="javascript:void(0);">护照</a></li>
											<li><a value="4" href="javascript:void(0);">军官证</a></li>
										</ul>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">证件号码：</label>
								<div class="col-sm-10">
									<input type="text" class="form-control ml150 input300"
										   id="id_card1" placeholder="证件号码" onblur="id_birthday('id_card1','birthday1')" value="${memberBase.postionNumber eq '0' ? '' : memberBase.postionNumber}"/>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">出生日期：</label>
								<div class="col-sm-10">
									<input type="text" input-type='date' class="form-control ml150 input150 validate[required]" id="birthday1" placeholder="出生日期" value="<fmt:formatDate value='${memberBase.birthday }' pattern='yyyy-MM-dd'/>"/>
									<em class="colorred">*</em>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">手机号码：</label>
								<div class="col-sm-10">
									<input type="text" class="form-control ml150 input300 validate[custom[mobile]]" id="phone1" placeholder="手机号码" value="${memberBase.phone eq '0' ? '' : memberBase.phone}"/>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">家庭座机：</label>
								<div class="col-sm-10">
									<input type="text" class="form-control ml150 input300 validate[custom[phone]]" id="telphone" value="${memberBase.telphone eq '0' ? '' : memberBase.telphone}" placeholder="家庭座机"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">居住地址：</label>
								<div class="col-sm-10 ml150">
									<div id="jsAddress_0"  class="selectbox_l">
										<input type="hidden" class="province" value="${!empty memberBase.resideProvince?memberBase.resideProvince:-1}"/>
										<input type="hidden" class="city" value="${!empty memberBase.resideCity?memberBase.resideCity:-1}"/>
										<input type="hidden" class="area" value="${!empty memberBase.resideArea?memberBase.resideArea:-1}"/>
										<div name="province" type="selectbox"  class="btn-group inline "></div>
										<div name="city" type="selectbox"  class="btn-group inline"></div>
										<div name="area" type="selectbox"  class="btn-group inline"></div>
									</div>
									<div class=" inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="juzhu_address1" value="${memberBase.resideAddress eq '0' ? '' : memberBase.resideAddress}" placeholder="详细地址"/>
										<em class="colorred">*</em>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="well_head">
					<div class="line"></div>
					<span class="pull-left">长者相关人员</span>
					<button type="button" class="btn btn-save btn-sm pull-right" id="member_relation">保存</button>
				</div>
				<div id="member_relation_jsp">
					<div class="panel-body">
						<form class="form-horizontal form_txt" role="form">
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">相关亲属：</label>
								<div class="col-sm-10 txt">
									<c:forEach  items="${memberEmergencyContactList}" var="emergency">
										<div class="inline">${emergency.emergencyContactName}</div>
										<div class="inline">
												${emergency.emergencyContactRel}
										</div>
										<div class="inline">
											<input type="text" class="form-control ml150 input300 validate[custom[mobile]]" id="phone1" placeholder="手机号码" value="${emergency.emergencyContactPhone eq '0' ? '' : emergency.emergencyContactPhone}"/>
										</div>
										<div class="inline">紧急联系人</div>
										<br/>
									</c:forEach>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="well_head">
					<div class="line"></div>
					<span class="pull-left">其他信息</span>
					<button type="button" class="btn btn-save btn-sm pull-right" id="other_info">保存</button>
				</div>
				<div id="member_other_jsp">
					<div class="panel-body  other">
						<form class="form-horizontal form_txt" role="form">
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">住院号：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="liveNo" value="${memberInfo.liveNo}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">责任医师：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="physician" value="${memberHealthystateRel.physician}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">护理等级：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="level" value="${memberHealthystateRel.level}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">病情：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="illness" value="${memberHealthystateRel.illness}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">注意事项：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="notice" value="${memberHealthystateRel.notice}" />
									</div>
								</div>
							</div>

							<div class="form-group">
								<label for="" class="col-sm-2 control-label">兴趣爱好：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="hoddy" value="${memberHealthystateRel.hoddy}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">饮食禁忌：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="foodType" value="${memberHealthystateRel.foodType}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">民族：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="nation" value="${memberInfo.nation}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">血型：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="bloodType" value="${memberInfo.bloodType}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">职业：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="profession" value="${memberInfo.profession}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">文化程度：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="cultureDegree" value="${memberInfo.cultureDegree}" />
									</div>
								</div>
							</div>

							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">婚姻状况：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="maritalStatus" value="${memberInfo.maritalStatus}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">经济来源：</label>
								<div class="col-sm-10 txt">
									<div class="inline">
										<input type="text" class="form-control input300 validate[maxSize[32],required]" id="pocketBook" value="${memberInfo.pocketBook}" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">健康状况：</label>
								<div class="col-sm-10 txt">
									<input type="text" class="form-control input300 validate[maxSize[32],required]" id="healthType" value="${memberHealthystateRel.healthType}" />
								</div>
							</div>
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">身体状况：</label>
								<div class="col-sm-10 txt">
									<input type="text" class="form-control input300 validate[maxSize[32],required]" id="bodyType" value="${memberHealthystateRel.bodyType}" />
								</div>
							</div>
							<div class="form-group">
								<label for="" class="col-sm-2 control-label">备注：</label>
								<div class="col-sm-10 txt">
									<input type="text" class="form-control input300 validate[maxSize[32],required]" id="remark" value="${memberInfo.remark}" />
								</div>
							</div>
						</form>
						<div id="huji_address_info" style="display: none"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="../../js/jquery.ptTimeSelect.js" ></script><!--日历插件-->
<script type="text/javascript" src="../../js/pickday.js" ></script><!--日历插件配置和调用-->
<script type="text/javascript" src="../../js/jquery.validationEngine-zh_CN.js" ></script>
<script type="text/javascript" src="../../js/jquery.validationEngine.js" ></script>
<script type="text/javascript" src="../../js/member/echo_member_base.js"></script>
<script type="text/javascript" src="../../js/jquery.ganged.js"></script><!-- 省市区联动 s -->
<script type="text/javascript" src="../../js/pro.js"></script><!--  省市区的json数据 -->
<script type="text/javascript" src="../../js/ajaxFileUpload.full.js" ></script>
<script type="text/javascript" src="../../js/jquery.cookie.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/jquery.joyride-2.1.js"></script> <!--向导 -->
<script type="text/javascript" src="../../js/jquery.placeholder.js"  charset="utf-8"></script><!-- placehoder兼容 -->
<script type="text/javascript">
    //修改长者信息界面最底部保存按钮事件
    var big_save_flag2 = 1;
    var big_save_flag4 = 1;
    var big_save_flag6 = 1;
    /****省市区联动 调用******/
    $("[id^='jsAddress']").ganged({'data': provinceList, 'width': 133, 'height': 32});
    function big_save () {
        var $text7 = $("#member_base").text();
        if($text7 == "保存"){
            update_member_base(1);
        }
        var $text8 = $("#member_relation").text();
        if($text8 == "保存" && big_save_flag2 == 1){
            updateMemberRelation(1);
        }
        var $text9 = $("#other_info").text();
        if($text9 == "保存" && big_save_flag2 == 1 && big_save_flag4 == 1){
            update_member_info(1);
        }

        if(big_save_flag2 == 0){
            var offset= $("[id='member_base']").offset();
            $(window).scrollTop(offset.top);
            return false;
        }

        if(big_save_flag4 == 0){
            get_update_member_base();
            var offset= $("[id='member_relation']").offset();
            $(window).scrollTop(offset.top);
            return false;
        }

        if(big_save_flag6 == 0){
            get_update_member_base();
            getUpdMemberRelation(0);
            var offset= $("[id='other_info']").offset();
            $(window).scrollTop(offset.top);
            return false;
        }

        window.location = "${ctx}/member/get_member_list?station=${member.serverStationCode}";
    };

    //大取消
    function big_cancel (){
        window.location = "${ctx}/member/get_member_list?station=${member.serverStationCode}";
    };

    //修改页面长者===长者相关===点击调用
    $("#member_relation").click(function(){
        var $text5 = $(this).text();
        if($text5 == "保存"){
            updateMemberRelation(0)
        }
        if($text5 == "编辑"){
            getUpdMemberRelation();
        }
    });

    //修改页面长者===长者相关===紧急联系人===id拼接
    function emergency_ids(){
        $("#emergency_ids").val("");
        var emergencyIds = "";
        $(":input[name='emergency_id']").each(function(){
            if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
                emergencyIds += $(this).val()+"_";
            }
        });
        $("#emergency_ids").val(emergencyIds);
    }

    //修改页面长者===长者相关===紧急联系人===姓名拼接
    function emergency_names(){
        $("#emergency_names").val("");
        var emergencyNames = "";
        $(":input[name='emergency_name']").each(function(){
            if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
                emergencyNames += $(this).val()+"_";
            }
        });
        $("#emergency_names").val(emergencyNames);
    }

    //修改页面长者===长者相关===紧急联系人===关系拼接
    function emergency_rels(){
        $("#emergency_rels").val("");
        var emergencyRels = "";
        $(":button[name='emergency_rel']").each(function(){
            if($(this).attr("value") != null
                && $(this).attr("value") != ""
                && $(this).attr("value") != undefined
                && $(this).attr("value") != "0"){
                emergencyRels += $(this).attr("value")+"_";
            }
        });
        $("#emergency_rels").val(emergencyRels);
    }

    //修改页面长者===长者相关===紧急联系人===联系电话拼接
    function emergency_phones(){
        $("#emergency_phones").val("");
        var emergencyPhones = "";
        $(":input[name='emergency_phone']").each(function(){
            if($(this).val() != null && $(this).val() != "" && $(this).val() != undefined){
                emergencyPhones += $(this).val()+"_";
            }
        });
        $("#emergency_phones").val(emergencyPhones);
    }

    //修改页面长者===长者相关===紧急联系人===是否紧急联系人
    function emergency_types(){
        $("#emergency_types").val("");
        var emergencyTypes = "";
        $(":input[name='emergency_type']").each(function(){
            if($(this).attr("value") != null
                && $(this).attr("value") != ""
                && $(this).attr("value") != undefined
                && $(this).attr("value") != "0"){
                emergencyTypes += $(this).val()+"_";
            }
        });
        $("#emergency_types").val(emergencyTypes);
    }

    //验证
    function validateEmergency(){
        var nameErrorCount = 0, nameRegexError = 0;
        $("input[name=emergency_name]").each(function(){
            var name = $.trim($(this).val());
            if(name == null || name == "" || name.length == 0){
                $(this).css("border","1px solid red");
                nameErrorCount++;
            }

            if(!(/^[\u4E00-\u9FA5A-Za-z0-9]{2,8}$/g).test(name)){
                $(this).css("border","1px solid red");
                nameRegexError++;
            }
        });

        if(nameErrorCount > 0){
            zhyAlert("请填写亲属姓名");
            return false;
        }

        if(nameRegexError > 0){
            zhyAlert("请填写正确的亲属姓名");
            return false;
        }

        var relErrorCount = 0;
        $("button[name=emergency_rel]").each(function(){
            var rel = $.trim($(this).attr("value"));
            if(rel == null || rel == "" || rel.length == 0 || rel == "0"){
                $(this).parent().css("border","1px solid red");
                relErrorCount ++;
            }
        });

        if(relErrorCount > 0){
            zhyAlert("请选择关系");
            return false;
        }

        var phoneErrorCount = 0, phoneRegexError = 0;
        $("input[name=emergency_phone]").each(function(){
            var phone = $.trim($(this).val());
            if(phone == null || phone == "" || phone.length == 0 )
            {
                $(this).css("border","1px solid red");
                phoneErrorCount++;
            }

            var regex = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/g;
            if(!regex.test(phone)){
                $(this).css("border","1px solid red");
                phoneRegexError++;
            }
        });

        if(phoneErrorCount > 0){
            zhyAlert("请填写手机号码");
            return false;
        }

        if(phoneRegexError > 0){
            zhyAlert("请正确填写手机号码");
            return false;
        }

        var typeErrorCount = 0, contactCount = 0;
        $("button[name=emergency_type]").each(function(){
            if($(this).val() == null || $(this).val() == "" || $(this).val().length == 0 || $(this).val() == "0"){
                $(this).parent().css("border","1px solid red");
                typeErrorCount ++;
            }else if($(this).val() == "2"){
                contactCount++;
            }
        });

        if(typeErrorCount > 0){
            zhyAlert("请选择是否为紧急联系人");
            return false;
        }

        if(contactCount > 5){
            zhyAlert("最多只能添加5位紧急联系人");
            $("button[name=emergency_type][value=2]:gt(4)").parent().css("border","1px solid red");
            return false;
        }

        return true;
    }

    function updateMemberRelation(flag){
        emergency_ids();
        emergency_names();
        emergency_rels();
        emergency_phones();
        emergency_types();

        if($("#emergency_names").val() === ""
            && $("#emergency_rels").val() === ""
            && $("#emergency_phones").val() === ""
            && $("#emergency_types").val() === "" ){
            return false;
        }

        if($("#emergency_names").val() != "" && $("#emergency_names").val() != null){
            var eme1 = $("#emergency_names").val().split("_");
            var eme2 = $("#emergency_rels").val().split("_");
            var eme3 = $("#emergency_phones").val().split("_");
            var eme4 = $("#emergency_types").val().split("_");
            if(eme1.length != eme2.length
                || eme2.length != eme3.length
                || eme3.length != eme4.length){
                big_save_flag4 = 0;
                zhyAlert("请填写完整紧急联系人信息！");
                return false;
            }
        }

        if(!validateEmergency()){
            big_save_flag4 = 0;
            return false;
        }

        var delIds = delIdArray.join(",");
        $.ajax({
            type : "POST",
            dataType: "json",
            url : "${ctx}/member/update_member_relation",
            async: false,
            data:{
                memberId: $("#member_id").val(),
                serverStationCode: $("#server_station_code").val(),
                emergencyIds: $("#emergency_ids").val(),
                emergencyNames: $("#emergency_names").val(),
                emergencyRels: $("#emergency_rels").val(),
                emergencyPhones: $("#emergency_phones").val(),
                emergencyTypes: $("#emergency_types").val(),
                delId: delIds
            },
            success: function(data) {
                if(data.resultCode === "SUCC" && data.data){
                    big_save_flag4 = 1;
                    if(flag == 0){
                        getSeeMemberRelation();
                    }
                }else{
                    big_save_flag4 = 0;
                    zhyAlert("保存失败");
                }
            }
        });
    }

    //获得长者===长者相关==查看页面
    function getSeeMemberRelation(flag){
        $.ajax({
            type : "post",
            dataType: "html",
            url : "${ctx}/member/get_see_member_relation",
            async: true,
            data:{
                memberId:$("#member_id").val()
            },
            success : function(data){
                $("#member_relation_jsp").empty().html(data);
                $("#member_relation").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
            }
        });
    }

    //获得长者===长者相关==修改/编辑页面
    function getUpdMemberRelation(flag){
        $.ajax({
            type : "post",
            dataType: "html",
            url : "${ctx}/member/get_update_member_relation",
            async: true,
            data:{
                memberId:$("#member_id").val()
            },
            success : function(data){
                $("#member_relation_jsp").empty().html(data);
                $("#member_relation").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
            }
        });
    }

    //获得长者基础信息===查看===页面
    function get_see_member_base(){
        $.ajax({
            type : "post",
            dataType: "html",
            url : "${ctx}/member/get_see_member_base",
            async: true,
            data:{
                memberId:$("#member_id").val()
            },
            success : function(data)
            {
                $("#member_base_jsp").empty().html(data);
                $("#member_base").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
            }
        });
    }

    //获得长者基础信息===修改===页面
    function get_update_member_base(){
        $.ajax({
            type: "post",
            dataType: "html",
            url: "${ctx}/member/get_update_member_base",
            async: true,
            data: {
                memberId:$("#member_id").val()
            },
            success: function(data) {
                $("#member_base_jsp").empty().html(data);
                $("#member_base").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
            }
        });
    }

    //点击长者修改页面中的其他信息调用
    $("#other_info").click(function(){
        var $text1 = $(this).text();
        if($text1 == "保存"){
            update_member_info(0);
        }

        if($text1 == "编辑"){
            get_update_member_info();
        }
    });

    //获得长者修改页面中的其他信息页面
    function get_update_member_info(){
        $.ajax({
            type : "post",
            dataType: "html",
            url: "${ctx}/member/update_member_other_jsp",
            async: false,
            data:{
                memberId:$("#member_id").val()
            },
            success: function(data){
                $("#member_other_jsp").empty().html(data);
                $("#other_info").removeAttr("class").attr("class","btn  btn-sm btn-save pull-right").empty().text("保存");
            }
        });
    }

    //长者其他信息保存===flag为0时，会的查看页面，为1时不获得查看页面
    function update_member_info(flag){
        if(!$("#member_other_form").validationEngine("validate")){
            big_save_flag6 = 0;
            return false;
        }
        if($("#huji_address").val().length >= 32){
            zhyAlert("详细地址长度应小于32");
            big_save_flag6 = 0;
            return false;
        }
        if($("#remark").val().length >= 256){
            zhyAlert("备注长度应小于256");
            big_save_flag6 = 0;
            return false;
        }

        var origianlNurseLevel='${nurseLevel}';
        var newNurseLevel=$("#newNurseLevel").val();
        if(origianlNurseLevel!=''){
            if(newNurseLevel==''){
                zhyAlert("请选择护理等级");
                big_save_flag6 = 0;
                return false;
            }
        }
        var originalLiveCode='${liveCode}';
        var newLiveCode=$("#liveCode").val();
        if(originalLiveCode.trim()!=''){
            if(newLiveCode==''){
                zhyAlert("请填写住院号");
                big_save_flag6 = 0;
                return false;
            }
        }


        var doctor=$("#doctor").val();
        var condition=$("#condition").val();
        var note=$("#note").val();
        if(doctor.trim()!=''||condition.trim()!=''||note.trim()!=''){
            if(doctor.length>20){
                big_save_flag6 = 0;
                return false;
            }
            if(condition.length>20){
                big_save_flag6 = 0;
                return false;
            }
            if(note.length>20){
                big_save_flag6 = 0;
                return false;
            }
        }

        hobbychecked();
        eat_taboochecked();
        take_carechecked();
        health_statechecked();
        body_statechecked();
        var other_value = new Array();
        if($("#other_hobby").val()!=""){
            other_value.push("hobby:"+$("#other_hobby").val());
        }

        if($("#other_eat_taboo").val()!=""){
            other_value.push("eat_taboo:"+$("#other_eat_taboo").val());
        }

        if($("#other_take_care").val()!=""){
            other_value.push("take_care:"+$("#other_take_care").val());
        }

        if($("#other_health_state").val()!=""){
            other_value.push("health_state:"+$("#other_health_state").val());
        }

        if($("#other_body_state").val()!=""){
            other_value.push("body_state:"+$("#other_body_state").val());
        }

        $.ajax({
            type: "post",
            dataType: "json",
            url: "${ctx}/member/save_member_info",
            async: false,
            data: {
                id: $("#infoId").val(),
                memberId: $("#member_id").val(),
                serverStationCode: $("#server_station_code").val(),
                kosekiProvince: $("#member_other_form").find(":input[name='province']").val(),
                kosekiCity: $("#member_other_form").find(":input[name='city']").val(),
                kosekiArea: $("#member_other_form").find(":input[name='area']").val(),
                kosekiAddress: $("#huji_address").val(),
                nation: $("#nation").attr("value"),
                bloodType: $("#blood_type").attr("value"),
                isRh: $("#is_rh").attr("value"),
                profession: $("#profession").val(),
                cultureDegree: $("#culture_degree").attr("value"),
                workUnit: $("#work_unit").val(),
                maritalStatus: $("#marital_status").attr("value"),
                pocketbook: $("#pocketbook").attr("value"),
                remark: $("#remark").val(),
                hobby: $("#hobby").val(),
                eatTaboo: $("#eat_taboo").val(),
                takeCare: $("#take_care").val(),
                healthState: $("#health_state").val(),
                bodyState: $("#body_state").val(),
                otherValue: other_value.join("@"),
                doctor:doctor,
                condition:condition,
                note:note,
                newNurseLevel:newNurseLevel,
                liveCode:newLiveCode
            },
            success : function(data){
                if(null != data && data.resultCode === "SUCC" && data.data){
                    big_save_flag6 = 1;
                    if(flag == 0){
                        $("#other_info").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
                        $.ajax({
                            type : "post",
                            dataType: "html",
                            url : "${ctx}/member/see_member_other_jsp",
                            async: true,
                            data:{
                                memberId:$("#member_id").val(),
                            },
                            success : function(data){
                                $("#member_other_jsp").empty().html(data);
                                $("#other_info").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
                                $("#edit_member_other").removeAttr("class").attr("class","btn  btn-sm btn_edit pull-right").empty().text("编辑");
                            }
                        });
                    }
                }else{
                    big_save_flag6 = 0;
                    zhyAlert("保存失败");
                }
            }
        });
    }

    //长者详细信息中的兴趣爱好-------兴趣爱好中的其他选项另行取值
    function hobbychecked(){
        var hobbys = new Array();
        $("input[name=hobby]:checked").each(function(){
            var val = $(this).val();
            if(val != null && val != "" && val.length > 0){
                hobbys.push(val);
            }
        });

        if(hobbys.length > 0){
            $("#hobby").val(hobbys.join("_"));
        }else{
            $("#hobby").val("");
        }
    }

    //长者详细信息中的饮食禁忌-------饮食禁忌中的其他选项另行取值
    function eat_taboochecked(){
        var eatTaboos = new Array();
        $("input[name=eat_taboo]:checked").each(function(){
            var val = $(this).val();
            if(val != null && val != "" && val.length > 0){
                eatTaboos.push(val);
            }
        });

        if(eatTaboos.length > 0){
            $("#eat_taboo").val(eatTaboos.join("_"));
        }else{
            $("#eat_taboo").val("");
        }
    }

    //长者详细信息中的照看人-------照看人中的其他选项另行取值
    function take_carechecked(){
        var takeCares = new Array();
        $("input[name=take_care]:checked").each(function(){
            var val = $(this).val();
            if(val != null && val != "" && val.length > 0){
                takeCares.push(val);
            }
        });

        if(takeCares.length > 0){
            $("#take_care").val(takeCares.join("_"));
        }else{
            $("#take_care").val("");
        }
    }

    //长者详细信息中的健康状况-------健康状况中的其他选项另行取值
    function health_statechecked(){
        var healthStates = new Array();
        $("input[name=health_state]:checked").each(function(){
            var val = $(this).val();
            if(val != null && val != "" && val.length > 0){
                healthStates.push(val);
            }
        });

        if(healthStates.length > 0){
            $("#health_state").val(healthStates.join("_"));
        }else{
            $("#health_state").val("");
        }
    }

    //长者详细信息中的身体状况-------身体状况中的其他选项另行取值
    function body_statechecked(){
        var bodyStates = new Array();
        $("input[name=body_state]:checked").each(function(){
            var val = $(this).val();
            if(val != null && val  != "" && val.length > 0){
                bodyStates.push(val);
            }
        });

        if(bodyStates.length > 0){
            $("#body_state").val(bodyStates.join("_"));
        }else{
            $("#body_state").val("");
        }
    }

    function id_birthday(idName,birthdayName){
        if($("#idType .dropdown-text").attr("value") !== "0"){
            return;
        }

        var postionNumber = $("#"+idName).val();
        //18位身份證號
        if(postionNumber!=null&&postionNumber.trim().length==18){
            $("#"+birthdayName).val(postionNumber.substring(6,10)+"-"+postionNumber.substring(10,12)+"-"+postionNumber.substring(12,14)).blur();
        }
        //15位身份证号码
        if (postionNumber!=null&&postionNumber.length==15) {
            var birthdayValue = postionNumber.substring(6,8);
            if (parseInt(birthdayValue) < 10) {
                birthdayValue = '20' + birthdayValue;
            }else{
                birthdayValue = '19' + birthdayValue;
            }
            birthdayValue = birthdayValue + '-' + postionNumber.substring(8,10) + '-' + postionNumber.substring(10,12);
            $("#"+birthdayName).val(birthdayValue).blur();
        }
    }

</script>
</body>
</html>